package com.smrs.asn.webapp.action;

import org.apache.commons.lang3.StringUtils;






public class SearchAsnDetailJsonAction extends AsnDetailAction{
	private static final long serialVersionUID = 1L;

	private Long rows = 0L;
	private Long page = 0L;
	private Long total = 0L;
	private Long records = 0L;
	private String sord;
	private String sidx;
	private String order;
	
	
	public Long getRows() {
		return rows;
	}


	public void setRows(Long rows) {
		this.rows = rows;
	}


	public Long getPage() {
		return page;
	}


	public void setPage(Long page) {
		this.page = page;
	}


	public Long getTotal() {
		return total;
	}


	public void setTotal(Long total) {
		this.total = total;
	}


	public Long getRecords() {
		return records;
	}


	public void setRecords(Long records) {
		this.records = records;
	}


	public String getSord() {
		return sord;
	}


	public void setSord(String sord) {
		this.sord = sord;
	}


	public String getSidx() {
		return sidx;
	}


	public void setSidx(String sidx) {
		this.sidx = sidx;
	}


	public String getOrder() {
		return order;
	}


	public void setOrder(String order) {
		this.order = order;
	}



	
	
	@Override
	public String execute() throws Exception {
		// 去空格
		getPager().setCurrentPage(page);
		getPager().setPageSize(rows);
		if(StringUtils.isNotEmpty(sidx)) {
			getPager().setOrderProperty(sidx);
			getPager().setOrder(StringUtils.defaultIfEmpty(sord, "asc"));
		}
		//String result = super.execute();
		pager = asnDetailService.findBySkuAndAsnHeader(null, asnHeader,pager);
		this.setTotal(this.getPager().getTotalPages());
		this.setRecords(this.getPager().getTotalRecords());
		return SUCCESS;
	}
}
